package edu.gdkm.demo5;

public class Teacher extends Person{

    private String course;

    public String getCourse() {
        return course;
    }

    public void setCourse(String course) {
        this.course = course;
    }


    @Override
    public void say() {
        System.out.println("大家好，我是一个老师");
        //super代表父类的对象
        super.say();
        System.out.println("我教授的科目是："+course);
    }

    public Teacher() {
       //默认值 100 , "待定" ，"待定"
       this("100","待定","待定");
    }

    public Teacher(String id, String name) {
        //super代表父类的构造方法
       super(id,name);
    }

    public Teacher(String id, String name, String course) {
        super(id, name);
        this.course = course;
    }
    public void teach(){
        System.out.println(course);
    }

    @Override
    public void run() {
        System.out.println("我是子类的run方法");
    }
}
